package com.xy.compose.main.view

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.xy.compose.resource_libs.R


@Composable
fun NavBottom(selectedIndex:Int,onSelectedChanged:(index:Int) ->Unit){
    Row(Modifier.padding(horizontal = 11.dp, vertical = 25.dp).background(Color.Red),horizontalArrangement=Arrangement.Center, verticalAlignment = Alignment.Bottom){
        Image(painterResource(if(selectedIndex == 0) R.mipmap.icon_navi_task else R.mipmap.icon_navi_task_unchecked),"task", modifier = Modifier.size(75.dp).clickable{
            onSelectedChanged(0)
        })
        Image(painterResource(if(selectedIndex == 1) R.mipmap.icon_navi_chat else R.mipmap.icon_navi_chat_unchecked),"chat", modifier = Modifier.size(75.dp).clickable{
            onSelectedChanged(1)
        })
        Image(painterResource(if(selectedIndex == 2) R.mipmap.icon_navi_me else R.mipmap.icon_navi_me_unchecked),"me", modifier = Modifier.size(75.dp).clickable{
            onSelectedChanged(2)
        })
    }

}
